<template>
    <div class="data_edit_home">
        <!-- title -->
        <el-col :span="24" style="margin-bottom:1px;">
            <h1>搜索歌曲信息</h1></el-col>
        <!-- search form -->
        <el-col :span="24" style="margin-bottom:10px;">
            <el-form :inline="true" :model="form" class='searchform'>
                <el-col :span="24" class="formbody" style="padding: 0;">
                    <el-form-item label="创建者">
                        <el-select placeholder="无" v-model="form.creator" min-width="120">
                            <el-option label="Candy" value="candy"></el-option>
                            <el-option label="Echo" value="echo"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="修改者">
                        <el-select placeholder="无" v-model="form.modifier">
                            <el-option label="Candy" value="candy"></el-option>
                            <el-option label="Echo" value="echo"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="创建时间">
                        <el-date-picker v-model="form.creatTime" type="daterange" placeholder="选择日期范围"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="修改时间">
                        <el-date-picker v-model="form.modifytime" type="daterange" placeholder="选择日期范围"></el-date-picker>
                    </el-form-item>
                </el-col>
                <el-col :span="24" class="center" style="padding: 0;">
                    <el-form-item>
                        <el-button type="primary" class="submit"><i class="icon-ddex-search"></i>查询</el-button>
                    </el-form-item>
                </el-col>
            </el-form>
        </el-col>
        <el-col :span="24" style="margin-bottom:1px;">
            <!-- 筛选 -->
            <el-form :inline="true" :model="filters" class="filterbar">
                <el-form-item>
                    <el-select placeholder="请选择" v-model="filters.status">
                        <el-option label="全部状态" value="all"></el-option>
                        <el-option label="未核验" value="none"></el-option>
                        <el-option label="xml生产成功" value="ok"></el-option>
                        <el-option label="xml生产失败" value="1"></el-option>
                        <el-option label="xml未开始生产" value="1"></el-option>
                        <el-option label="物料包正在推送" value="echo"></el-option>
                        <el-option label="物料包推送成功" value="echo"></el-option>
                        <el-option label="物料包推送失败" value="echo"></el-option>
                        <el-option label="物料包未开始推送" value="echo"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.number" placeholder="物料序号"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.albumproductid" placeholder="Album Product ID"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.albumname" placeholder="Album Name"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.artist" placeholder="Artist"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.trackproductid" placeholder="Track Product ID"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.trackname" placeholder="Track Name"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.isrc" placeholder="ISRC/ICPN、UPC"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.musiclabel" placeholder="Music Label"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.supplier" placeholder="Supplier"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.creatdate" placeholder="Create Date"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.creatuser" placeholder="Create User"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.modifydate" placeholder="Modify Date"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input v-model.trim="filters.modifyuser" placeholder="Modify user"></el-input>
                </el-form-item>
            </el-form>
            <!-- grid -->
            <el-table :data="tableData" @row-contextmenu="showMenu" align="left" :row-class-name="tableRowClassName" @header-click="headClick">
                <el-table-column prop="status" label="Status" show-overflow-tooltip>
                    <template scope="scope">
                        <i class="icon-ddex-wait" style="color: #fea602"></i>
                        <span style="margin-left: 5px">{{ scope.row.status }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="Serial number" sortable>
                    <template scope="scope">
                        <span style="font-weight: bold;">{{ scope.row.number }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="albumproductid" label="Album Product ID" show-overflow-tooltip width="100"></el-table-column>
                <el-table-column prop="albumname" label="Album Name" show-overflow-tooltip></el-table-column>
                <el-table-column prop="artist" label="Artist" show-overflow-tooltip></el-table-column>
                <el-table-column prop="trackproductid" label="Track Product ID" show-overflow-tooltip min-width="82"></el-table-column>
                <el-table-column prop="trackname" label="Track Name" show-overflow-tooltip></el-table-column>
                <el-table-column prop="isrc" label="ISRC/ICPN、UPC" show-overflow-tooltip width="110"></el-table-column>
                <el-table-column prop="musiclabel" label="Music Label" show-overflow-tooltip></el-table-column>
                <el-table-column prop="supplier" label="Supplier" show-overflow-tooltip></el-table-column>
                <el-table-column prop="creatdate" label="Create Date" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="creatuser" label="Create User" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="modifydate" label="Modify Date" show-overflow-tooltip sortable></el-table-column>
                <el-table-column prop="modifyuser" label="Modify user" show-overflow-tooltip sortable></el-table-column>
            </el-table>
        </el-col>
        <!-- 分页 -->
        <el-col :span="24" class="pagination">
            <el-pagination :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400"></el-pagination>
        </el-col>
        <!-- 右键菜单 -->
        <div class="menu" v-show="menuShow">
            <el-button :plain="true" type="info" @click="materialUpload">人工核验&数据编辑</el-button>
            <br>
            <el-button :plain="true" type="info" @click="seeLog">查看日志状态详情</el-button>
            <br>
            <el-button :plain="true" style="margin-bottom: 0;" type="info" @click="exportFile">导出为SRC-v2文件</el-button>
            <br>
        </div>
        <!-- 自定义列 -->
    </div>
</template>
<script>
export default {
    data() {
        return {
            menuShow: false,
            form: {
                creator: '',
                modifier: '',
                creatTime: '',
                modifytime: '',
            },
            filters: {
                status: '',
                number: '',
                albumproductid: '',
                albumname: '',
                artist: '',
                albumname: '',
                trackproductid: '',
                trackname: '',
                isrc: '',
                musiclabel: '',
                supplier: '',
                creatdate: '',
                creatuser: '',
                modifydate: '',
                modifyuser: '',
            },
            tableData: [{
                status: 'hahhahah',
                number: '02',
                albumproductid: '哈哈哈哈',
                albumname: '哈哈哈哈',
                artist: '哈哈哈哈',
                albumname: '哈哈哈哈',
                trackproductid: '哈哈哈哈',
                trackname: '哈哈哈哈',
                isrc: '',
                musiclabel: '12342435435647687687',
                supplier: '哈哈哈哈',
                creatdate: '哈哈哈哈',
                creatuser: '哈哈哈哈',
                modifydate: '哈哈哈哈',
                modifyuser: '哈哈哈哈',
            }, {
                status: 'hahhahah',
                number: '02',
                albumproductid: '哈哈哈哈',
                albumname: '哈哈哈哈',
                artist: '哈哈哈哈',
                albumname: '哈哈哈哈',
                trackproductid: '哈哈哈哈',
                trackname: '哈哈哈哈',
                isrc: 'ytyutyuytuty',
                musiclabel: '12342435435647687687',
                supplier: '哈哈哈哈',
                creatdate: '哈哈哈哈',
                creatuser: '哈哈哈哈',
                modifydate: '哈哈哈哈',
                modifyuser: '哈哈哈哈',
            }, {
                status: 'hahhahah',
                number: '02',
                albumproductid: '哈哈哈哈',
                albumname: '哈哈哈哈',
                artist: '哈哈哈哈',
                albumname: '哈哈哈哈',
                trackproductid: '哈哈哈哈',
                trackname: '哈哈哈哈',
                isrc: '',
                musiclabel: '12342435435647687687',
                supplier: '哈哈哈哈',
                creatdate: '哈哈哈哈',
                creatuser: '哈哈哈哈',
                modifydate: '哈哈哈哈',
                modifyuser: '哈哈哈哈',
            }],
            tableData2: []
        }
    },
    methods: {
        headClick(column, event) {
            alert(5555)
        },
        tableRowClassName(row, index) {
            if (index % 2 == 0) {
                return 'info-row';
            }
        },
        showMenu(column, event) {
            event.preventDefault();
            let left = event.pageX - 100;
            let top = event.pageY - 100;
            $('.menu').css({ top: top, left: left })
            this.menuShow = !this.menuShow;
        },
        materialUpload() {
            this.menuShow = false
            alert(333)
        },
        seeLog() {
            this.menuShow = false
            alert(555)
        },
        exportFile() {
            this.menuShow = false;
            this.$confirm('是否将当前选中的专辑“导出为”SRC-V2表并保存到本地', '提示', {
                confirmButtonText: '确认',
                cancelButtonText: '放弃'
            })
        }
    }
}
</script>
<style lang="less">
.data_edit_home {
    box-sizing: border-box;
    padding: 15px;
    width: 100%;
    overflow: auto;
    height: 100%;

    .el-input__inner {
        font-size: 13px;
    }

    .el-col {
        background-color: #fff;
        padding: 15px;
        min-width: 700px;

        h1 {
            padding-top: 5px;
            padding-bottom: 5px;
            font-size: 13px;
        }

        .el-form-item {
            margin-bottom: 0;
        }

        .formbody {
            display: flex;
            justify-content: space-around;
            margin-bottom: 20px;
            margin-top: 10px;

            .el-form-item__label {
                font-size: 13px;
            }
        }
        .el-button,
        .el-textarea__inner {
            font-size: 13px;
        }

        .submit {
            padding: 10px 30px;

            i {
                margin-right: 15px;
            }
        }
    }

    .filterbar {
        padding-bottom: 15px;
        border-bottom: 2px solid #e8f2f7;
        display: flex;
        font-size: 12px;
    }

    .el-table {
        font-size: 12px;
        border: 0 none;

        .info-row {
            background: #f0f5f6;
        }

        thead div {
            background-color: #fff
        }

        .caret-wrapper {
            display: flex;
            margin-top: 16px;
        }
        .cell {
            padding-left: 10px;
            padding-right: 10px;
        }

        th {
            background-color: #fff;

            div {
                padding-left: 10px;
                padding-right: 10px;
            }
            .cell {
                word-wrap: break-word;
                word-break: keep-all;
                display: flex;
            }
        } // 排序图标颜色
        .sort-caret.ascending {
            border-bottom: 5px solid #E2EFF2;
        }
        .descending .sort-caret.descending {
            border-top-color: #3290FD;
        }
        .ascending .sort-caret.ascending {
            border-bottom-color: #3290FD;
        }
        .sort-caret.descending {
            border-top-color: #E2EFF2;
        }
    }

    .el-table__footer-wrapper thead div,
    .el-table__header-wrapper thead div {
        background-color: #fff;
    }
    .el-table::after,
    .el-table::before {
        background-color: #fff;
    }

    .pagination {
        background-color: #F9FCFC;
    }
    .pagination .el-pagination {
        padding: 10px 0;
        text-align: right;
    }

    .menu {
        padding: 10px;
        display: inline-block;
        border: 1px solid #CDDDE5;
        border-radius: 5px;
        position: absolute;
        top: 0;
        left: 0;
        background-color: #fff;
        z-index: 9999;

        .el-button {
            width: 150px;
            font-size: 12px;
            margin-bottom: 5px;
        }
    }
}
</style>